public class work01 {
    public static void main(String[] args) {
        int[] nums = {100, 50, 90, 60, 80, 70};
        int max = nums[0];
        int min = nums[0];
        int sum = 0;
        for (int num : nums) {
            if (num > max) {
                max = num;
            }
            if (num < min) {
                min = num;
            }
            sum += num;
        }
        sum -= max + min;
        int average = sum / (nums.length - 2);
        System.out.println("最大值为: " + max);
        System.out.println("最小值为: " + min);
        System.out.println("去掉最大值和最小值后的平均值为: " + average);
    }
}
